package org.tostring.pork;

import java.util.List;

import javax.inject.Inject;

import org.apache.log4j.Logger;
import org.pork.domain.ZipcodeVO;
import org.pork.service.ZipcodeService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/zipcode")
public class ZipcodeControl {
	
	private static final Logger logger = Logger.getLogger(ZipcodeControl.class);
	
	@Inject
	ZipcodeService zService;
	
	
	@RequestMapping(method=RequestMethod.GET)
	public String searchZipCode(Model model){
		

		return null;
	
	}
	
	
	@RequestMapping(value="/searchcode")
	public @ResponseBody List<ZipcodeVO> searchZipCode(String dong){
		
		logger.info("list.............." + dong);
		
		List<ZipcodeVO> list = null;
		
		
		try {
			
			list = zService.list(dong);
			
			
		} catch (Exception e) {
			
			e.printStackTrace();
			
		}
		
		logger.info(list.toString());
		
		return list;
		

	}
	
	@RequestMapping(method=RequestMethod.POST)
	public void errorZipCode(){
		
	}
}
